<div id="content" class="inputForm">
	<?php
		include_once '../com/mss/action/MonasteryAction.php';
		
		$id = "";
		$name = "";
		$location = "";
		$address = "";
		$telephone = "";
		$errors = array();
		$errors['success'] = "START";
		
		$monastery_action = new MonasteryAction();
		if (isset($_POST['submit'])) {
			$id = $_POST['id'];
			$name = $_POST['name'];
			$location = $_POST['location'];
			$address = $_POST['address'];
			$telephone = $_POST['telephone'];

			$monastery = new Monastery($id, $name, $location, $address, $telephone);
			$errors = $monastery_action->update($monastery);
		} else {
			$id = $_GET['id'];
			$monastery = $monastery_action->view($id);
			$name = $monastery->getName();
			$location = $monastery->getLocation();
			$address = $monastery->getAddress();
			$telephone = $monastery->getTelephone();
		}
	?>
	<h4>Update Monastery</h4>
	<?php 
	if ($errors['success'] != "START") {
		include_once 'info.php';
	}
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
		<input type="hidden" name="id" value="<?php echo $id?>"/>
		<table class="inputFormTable">
			<tr>
				<td><label>Name<span class="required">*</span></label></td>
				<td><input type="text" name="first_name" width="200px;" value="<?php echo $name?>"/></td>
			</tr>
			<tr>
				<td><label>Location</label></td>
				<td><input type="text" name="last_name" width="200px;" value="<?php echo $location?>"/></td>
			</tr>
			<tr>
				<td><label>Address</label></td>
				<td><input type="text" name="mobile" width="200px;" value="<?php echo $address?>" /></td>
			</tr>
			<tr>
				<td><label>Telephone</label></td>
				<td><input type="text" name="email" width="200px;" value="<?php echo $telephone?>" /></td>
			</tr>
			<tr>
				<td></td>
				<td align="right"><input type="submit" name="submit" value="Submit" class="formbutton" align="right"/></td>
			</tr>
		</table>
	</form>
	<br><br>
</div>
